window.onscroll=function(){
	//返回顶部的按钮显示和消失
	var scrollTopHeight = 200;
	if (document.body.scrollTop > scrollTopHeight || document.documentElement.scrollTop > scrollTopHeight)
	{
        //返回顶部的按钮显示
        $(".to_the_top").css({
            "display":"block"
        });
		showTimeout=setTimeout(function(){
			if(document.body.scrollTop > scrollTopHeight || document.documentElement.scrollTop > scrollTopHeight)
			{
                $(".to_the_top").css({
                    "opacity":1,
					"bottom":"40px"
                });
			}
		},300);
	}
	else
	{
		//返回顶部的按钮消失
        $(".to_the_top").css({
            "opacity":0,
            "bottom":"10px"
        });
		hideTimeout=setTimeout(function(){
			if(document.body.scrollTop <= scrollTopHeight && document.documentElement.scrollTop <= scrollTopHeight)
			{
                $(".to_the_top").css({
                    "display":"none"
                });
			}
		},300);
	}
	
	//顶部菜单栏变色
	var headerFixHeight = 30;
	if (document.body.scrollTop > headerFixHeight || document.documentElement.scrollTop > headerFixHeight)
	{
		//菜单栏变色
		$("header").css({
			"backgroundColor":"#ffffff",
			"boxShadow":"0px 5px 20px rgba(0,0,0,0.2)",
			"padding-bottom":"0"
		});
		$(".logo a").css({
            "color":"#333333"
        });
        $(".header_nav ul li a").css({
            "color":"#333333",
			"padding":"2px 20px 12px 20px"
        });
        $(".logo").css({
			"margin":"0"
		});
	}
	else
	{
		//取消菜单栏变色
        if(!$("header").hasClass("dark"))
        {
            $("header").css({
                "backgroundColor":"transparent",
            });
            $(".logo a").css({
                "color":"#ffffff"
            });
            $(".header_nav ul li a").css({
                "color":"#ffffff",
            });
        }
        $("header").css({
            "boxShadow":"none",
            "padding-bottom":"20px"
        });
        $(".header_nav ul li a").css({
            "padding":"12px 20px"
        });
        $(".logo").css({
            "margin":"10px 0"
        });
	}

	//技能
    if($(".skill").length!=0)
    {
        var skillToTop=$(".skill").offset().top - $(window).scrollTop();
        if(skillToTop<700 && skillToTop>-120)
        {
            $(".skill_bar").each(function () {
                $(this).find(".skill_progress_bar").eq(0).css({
                    width:$(this).find(".skill_progress_bar").eq(0).data("progress")+"%"
                });
            });
        }
        else
        {
            $(".skill_progress_bar").css({
                width:0
            });
        }
    }

    //教育
    if($(".timeline_item").length!=0)
    {
        $(".timeline_item").each(function () {
            var tlToTop=$(this).find(".timeline_content").eq(0).offset().top - $(window).scrollTop();
            if(tlToTop<500)
            {
                $(this).find(".timeline_content").css({
                    opacity: 1,
                    top:0
                });
            }
            else
            {
                $(this).find(".timeline_content").css({
                    opacity: 0,
                    top:"50px"
                });
            }
        });
    }

};

//返回顶部
function toTop()
{
	$("html,body").animate({
		scrollTop:0
	},500);
}